package liuwanghui.config;

import io.swagger.v3.oas.models.OpenAPI;
import io.swagger.v3.oas.models.info.Info;
import io.swagger.v3.oas.models.info.Contact;
import io.swagger.v3.oas.models.ExternalDocumentation;
import io.swagger.v3.oas.models.security.SecurityScheme;
import io.swagger.v3.oas.models.Components;
import io.swagger.v3.oas.annotations.OpenAPIDefinition;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
@OpenAPIDefinition
public class SwaggerConfig {
    
    @Bean
    public OpenAPI dealerOpenAPI() {
        return new OpenAPI()
            .info(new Info()
                .title("经销商管理系统 API")
                .description("经销商管理系统后端接口文档")
                .version("v1.0.0")
                .contact(new Contact()
                    .name("开发团队")
                    .email("support@example.com")))
            .externalDocs(new ExternalDocumentation()
                .description("系统使用说明")
                .url("https://example.com/docs"))
            .components(new Components()
                .addSecuritySchemes("bearer-jwt", 
                    new SecurityScheme()
                        .type(SecurityScheme.Type.HTTP)
                        .scheme("bearer")
                        .bearerFormat("JWT")
                        .description("JWT认证token")));
    }
} 